package com.health.appoint.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 预约挂号表
 * @TableName appoint
 */
@TableName(value ="appoint")
@Data
public class Appoint implements Serializable {
    /**
     * 主键
     */
    @TableId
    private Long id;

    /**
     * 患者地址
     */
    private String patientAddress;

    /**
     * 医生地址
     */
    private String doctorAddress;

    /**
     * 科室名
     */
    private String department;

    /**
     * 医院名
     */
    private String hospitalName;

    /**
     * 预约日期
     */
    private LocalDateTime appointmentTime;

    /**
     * 预约日期段 如"09:00-09:30"
     */
    private String timeSlot;

    /**
     * 挂号状态 0-预约 、1-取号、2-完成、3-取消
     */
    private Integer status;

    /**
     * 患者预约时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Appoint other = (Appoint) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPatientAddress() == null ? other.getPatientAddress() == null : this.getPatientAddress().equals(other.getPatientAddress()))
            && (this.getDoctorAddress() == null ? other.getDoctorAddress() == null : this.getDoctorAddress().equals(other.getDoctorAddress()))
            && (this.getDepartment() == null ? other.getDepartment() == null : this.getDepartment().equals(other.getDepartment()))
            && (this.getHospitalName() == null ? other.getHospitalName() == null : this.getHospitalName().equals(other.getHospitalName()))
            && (this.getAppointmentTime() == null ? other.getAppointmentTime() == null : this.getAppointmentTime().equals(other.getAppointmentTime()))
            && (this.getTimeSlot() == null ? other.getTimeSlot() == null : this.getTimeSlot().equals(other.getTimeSlot()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPatientAddress() == null) ? 0 : getPatientAddress().hashCode());
        result = prime * result + ((getDoctorAddress() == null) ? 0 : getDoctorAddress().hashCode());
        result = prime * result + ((getDepartment() == null) ? 0 : getDepartment().hashCode());
        result = prime * result + ((getHospitalName() == null) ? 0 : getHospitalName().hashCode());
        result = prime * result + ((getAppointmentTime() == null) ? 0 : getAppointmentTime().hashCode());
        result = prime * result + ((getTimeSlot() == null) ? 0 : getTimeSlot().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", patientAddress=").append(patientAddress);
        sb.append(", doctorAddress=").append(doctorAddress);
        sb.append(", department=").append(department);
        sb.append(", hospitalName=").append(hospitalName);
        sb.append(", appointmentDate=").append(appointmentTime);
        sb.append(", timeSlot=").append(timeSlot);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}